// -*- coding: utf-8 -*- 
/**
 * Project: AlgorithmsLearn
 *
 * @author: yanking
 * Create time: 2022-03-30 23:55
 * IDE: IntelliJ IDEA
 * Introduction:
 */
package com.LeetCodeT.BinaryAlgorithms;

import org.junit.jupiter.api.Test;

import java.math.BigInteger;
import java.util.stream.Stream;

public class ReverseBits {
    /**
     * 二进制数字转化
     */
    // you need treat n as an unsigned value
    public int reverseBits(int n) {
        int ans = 0;
        for (int i = 0; i < 32; i++) {
            if (((n >> i) & 1) == 1) {
                ans |= (1 << (31 - i));
            }
        }
        return ans;
    }


}
